<?php
class Table_Apoursujet extends Zend_Db_Table_Abstract
{
    protected $_name    = 'apoursujet';
    protected $_primary = array('ARTICLE_NUMERO','VIP_NUMERO');
    protected $_sequence = false; //la table a un autoincrément

	public function getArticleByVIP($id){
	    	
		return $this->fetchAll($this
	       	 	->select()
	       	 	->from($this,array('ARTICLE_NUMERO'))
	       	 	->where('VIP_NUMERO = ?', $id)
	     	);
    }
    
	public function getAllVip(){
    	
         return $this->fetchAll($this
        	->select()
        	->from($this, array('VIP_NUMERO'))
        	->distinct()
        	);
    }
    
	public function insertArticle($numvip,$numarticle){
		$data = array('ARTICLE_NUMERO'=> $numarticle,
					  'VIP_NUMERO'=> $numvip);
		return $this->insert($data);
	}
	
	public function deleteArticle($numart){
		$this->delete('ARTICLE_NUMERO = '.$numart);
	}
	
	public function deleteVip($numvip){
		$this->delete('VIP_NUMERO = '.$numvip);
	}
}